//
//  CommonTableViewCell.m
//  EnterpriseEdition
//
//  Created by ypj on 2021/10/9.
//

#import "CommonTableViewCell.h"

@implementation CommonTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.contentTF.delegate=self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

+(CGFloat)cellHeight{
    return 50;
}

+(NSString *)reuseIdentifier{
    return @"CommonTableViewCell";
}

-(void)textFieldDidEndEditing:(UITextField *)textField
{
    [textField resignFirstResponder];
    self.currentValueBlock(self.contentTF.text, self.indexPath);
}

#pragma mark  把输入的值和完没完成的bool变量传过去
-(BOOL)textFieldShouldReturn:(UITextField *)textField
{
    [textField resignFirstResponder];
    self.currentValueBlock(self.contentTF.text, self.indexPath);
    return YES;
}

-(void)textFieldDidChangeSelection:(UITextField *)textField{
    if (textField.tag == 99) {
        if (textField.text.length > 18) {
            textField.text = [textField.text substringToIndex:18];
        }
    }
   else if (textField.tag == 100){
        if (textField.text.length > 11) {
            textField.text = [textField.text substringToIndex:11];
        }
    }
    else if (textField.tag == 101) {
        if (textField.text.length > 20) {
            textField.text = [textField.text substringToIndex:6];
        }
    }
}
@end
